import java.util.Scanner;

public class test1 {
public static int LastStringLong(String str1){
    int i = str1.lastIndexOf(' ');
    int j = str1.length();
    return  j - i - 1;
}

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        System.out.println(LastStringLong(s));
    }
}
